﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using BDSUETableAdapters;


public partial class GestionarPeriodosPracticas_CrearPeriodoPractica : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void CalendarFechaInicio_SelectionChanged(object sender, EventArgs e)
    {
        CalendarFechaInicio.Visible = false;

    }
    /// <summary>
    /// se quitan las fechas del formulario que no correspondan al mes actual   
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void CalendarFechaInicio_DayRender(object sender, DayRenderEventArgs e)
    {
        if (e.Day.IsOtherMonth)
        {
            e.Cell.Text = "";

        }
    }
    protected void ButtonCrear_Click(object sender, EventArgs e)
    {
        if (CalendarFechaInicio.SelectedDate < CalendarFechaLimite.SelectedDate)
        {
            string FechaInicio = CalendarFechaInicio.SelectedDate.ToShortDateString();
            string FechaLimite = CalendarFechaLimite.SelectedDate.ToShortDateString();
            GestionarPeriodosPracticas gpp = new GestionarPeriodosPracticas();
            gpp.CrearPeriodo(FechaInicio, FechaLimite, TextBoxNombreProceso.Text, DropDownList1.SelectedItem.Text);
            ScriptManager.RegisterStartupScript(this, this.GetType(), "myscript", "$.modaldialog.success('Periodo registrado <br /><div align=\"center\"><a href=\"FrConsPeriodosPracticas.aspx\"><img src=\"../images/ok2.png\"/></a></div>');", true);
        }
        else
            ScriptManager.RegisterStartupScript(this, this.GetType(), "myscript", "$.modaldialog.error('La fecha límite no debe ser menor a la inicial', {timeout: 3 , showClose: false });", true);


    }

}
